package com.cwj.lab3.博客需要.最短路径问题;

import com.cwj.lab1.myArrayList;
import com.cwj.lab3.博客需要.Graph_matrix_2;
import com.cwj.lab3.博客需要.Graph_table_2;

public class Dijksta {
    Graph_table_2 graphTable2;
    Graph_matrix_2 graphMatrix2;
    int[]parent;
    int[]smallVal;

    public Dijksta(Graph_matrix_2 graphMatrix2) {
        this.graphMatrix2 = graphMatrix2;
    }

    public Dijksta(Graph_table_2 graphTable2) {
        this.graphTable2 = graphTable2;
    }


    public void Done(int start){
        int v_num=this.graphTable2.getV_num();
        Graph_table_2.Edge edge=null;
        this.parent=new int[v_num];
        this.smallVal=new int[v_num];
        for (int i = 0; i <v_num ; i++) {
            this.parent[i]=-1;
            this.smallVal[i]=Integer.MAX_VALUE;
        }
        myArrayList<Graph_table_2.Edge>list=this.graphTable2.getNodeList().get(start).getEdgeList();
        for (int i = 0; i <list.size() ; i++) {
            edge=list.get(i);
            this.parent[edge.getTo()]=start;
            this.smallVal[edge.getTo()]= edge.getVal();
        }
        for (int i = 0; i <v_num ; i++) {
            if(i==start){
                continue;
            }

        }
    }

}
